1. Field of the Invention
Apparatuses and methods consistent with the present invention relate to a portable storage device and a method of data recovery using the same, by which, when the integrity of recorded data is damaged, the integrity of the recorded data can be easily recovered.
2. Description of the Related Art
In general, electronic devices, such as home appliances, communication devices, and set-top boxes, use portable storage media for storing and processing data. Examples of portable storage media include hard disc drives, floppy disks, universal serial bus (USB) flash drives (UFDs), secure digital (SD) cards, memory sticks, multimedia memory cards (MMCs), and compact flash cards.
Referring to FIG. 1, a portable storage medium 10 is connected to a host device 20 by being inserted into a slot 21 formed in the host device 20. Once connected to the host device 20, the portable storage medium 10 receives data from the host device 20 and stores the data. The host device 20 includes a file system which stores data in the portable storage medium 10 as directories and files and manages the directories and the files, and stores the file system in the portable storage medium 10 together with the data.
To represent simple data as meaningful data, that is, from binary data of 0 and 1 to data in the form of, for example, a file or a directory, a file system is processed for obtaining abstract data, e.g., a volume, a data block map, data blocks, directories and files. A file system operation refers to an operation of indexing and modifying the abstract data processed in the file system.
The file system operation includes processes for updating the abstract data. Integrity of the file system can be ensured only when all processes of the file system operation are entirely performed or any process of the file system operation is not performed at the time of the file system operation.
If a power supply is suddenly interrupted or the portable storage medium 10 is separated from the host device 20 during the file system operation, a possibility of damaging the integrity of the file system increases due to abnormal termination of the file system operation. Thus, there is a need for a scheme for recovering the integrity of the file system when the power supply is interrupted or the portable storage medium 10 is separated from the host device 20 before completion of the file system operation.
To recover the integrity of the file system, the host device 20 usually records predetermined recovery information in the portable storage medium 10. Thereafter, if the integrity of the file system of the portable storage medium 10 is damaged, the host device 20 recovers the file system using the recorded recovery information, thereby recovering the integrity of the file system.
FIG. 2 is a flowchart illustrating a method for recording recovery information in the portable storage medium 10 by the host device 20 according to prior art.
As shown in FIG. 2, the host device 20 records data and a file system in the portable storage medium 10 through a file system operation in step S10.
When integrity of the file system is damaged due to occurrence of an unexpected event during the file system operation, the host device 20 records recovery information in a predetermined region of the portable storage medium 10 to recover the integrity of the file system in step S20.
At this time, the host device 20 records a logging method or an image of the file system in the portable storage medium 10, thereby recovering the integrity of the file system.
When a host device connected with the portable storage medium 10 is changed, the new host device recovers the integrity of the file system using recovery information recorded in the portable storage medium 10.
However, if the new host device does not support the recovery information recorded in the portable storage medium 10 or uses another type of recovery information, it is difficult for the new host device to recover the damaged integrity of the file system of the portable storage medium.
Thus, there is a need for a method for securing the integrity of the file system of the portable storage medium 10 even when the new host device does not support the recovery information recorded in the removable recording medium 10.
Japanese Patent Publication No. 1991-094352 discloses a technique in which when a damaged region of data is generated due to a power failure during recording with respect to an external recording medium, an interrupt signal is transmitted at the time of interruption of the power supply, the start through the end of a predetermined unit of data is checked, and re-recording is performed on the damaged region through the supply of an independent power source using the check information. However, this technique involves re-writing damaged data when the same host device records data in the external recording medium, and thus it is difficult for another host device to record damaged data in the external recording medium.